<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工厂模式</title>
</head>
<body>
<script>
    //1.工厂应有厂长来决定运行哪条产品线
    //2.消费者-》子类
    var gongchang={};
    gongchang.chanyifu=function(){
        this.gongren=100;
        alert("我们有"+this.gongren);
    }
    gongchang.chanxie=function(){
        this.gongren=300
        alert('产鞋子')
    }
    gongchang.yunshu=function(){
        this.gongren=400;
        alert("运输")
    }
    gongchang.changzhang=function(para){
        return new gongchang[para]();
    }
    var me=gongchang.changzhang("chanxie");
    alert(me.gongren)
</script>
</body>
</html>